<!--添加招聘信息组件-->
<template>
  <div class="Home">
    <div class="rightmain">
      <div class="rightmainbody">
        <div class="rightmaintext">
          <div class="rightmaintextleft">职位名称*:</div>
          <div class="rightmaintextright">
            <el-input v-model="inputName" placeholder=" "></el-input>
          </div>
        </div>
        <div class="rightmaintext">
          <div class="rightmaintextleft">发布时间:</div>
          <div class="rightmaintextright">
            <el-input v-model="inputTime" placeholder=" "></el-input>
          </div>
        </div>
        <div class="rightmaintext">
          <div class="rightmaintextleft">职位详情*:</div>
        </div>
      </div>
      <div class="rightmiddle">
        <div id="editor">
          <p>
            欢迎使用
            <b>wangEditor</b> 富文本编辑器
          </p>
        </div>
      </div>
      <div class="rightfooter">
      <el-button round @click="submit">发布</el-button>
    </div>
    </div>
    <!-- </div> -->
    <!-- </div> -->
  </div>
</template>

<script>
import E from "wangeditor";
export default {
  name: "addinfo",
  data() {
    return {
      inputName: "",
      inputTime: "",
      editor: "",
      content:"",
      submitInfo:{title:"",releaseTime:"",content:""}, 
    };
  },
  mounted() {
    var that=this
    this.editor = new E("#editor");
    this.editor.customConfig.onchange = function (text) {
      console.log(text);
      that.content=text
      that.submitInfo.content=text
      // console.log(that.submitInfo.content)
    };
    this.editor.customConfig.uploadImgServer =
      "http://dl.sword.ink:2335/upload/picture";
    //必要设置，值必须为“myfiles”
    this.editor.customConfig.uploadFileName = "myfiles";
    // 图片最大体积为20MB
    this.editor.customConfig.uploadImgMaxSize = 20 * 1024 * 1024;
    //超时时间要设置长一点，否则大图片上传可能失败，默认为10秒，这里设置为30秒
    this.editor.customConfig.uploadImgTimeout = 30000;
    this.editor.create();
    this.editor.txt.html("<p>欢迎使用wangEditor编辑器</p>");
  },
  methods:{
    submit(){
     // console.log(this.content)
    //console.log(this.inputName)
      this.submitInfo.title = this.inputName;
      this.submitInfo.content = this.content;
      this.submitInfo.releaseTime = this.inputTime;
      // this.axios.post("http://dl.sword.ink:2335/recruit?title="+this.submitInfo.title+"&releaseTime="+this.submitInfo.releaseTime+"&content="+this.submitInfo.content).then((response) => {
      //  console.log(response);
      let config = {
        headers: { 'Content-Type': 'application/json' },
      };
       this.$axios.post("http://sword.ink:2334/recruit" ,JSON.stringify(this.submitInfo),config).then((res) => { 
          console.log(res);
    });
  },
  },
};
</script>


<style scoped>
.Home {
  /* display: grid; */
  height: 80vh;
  width: 80vw;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  box-sizing: border-box;
  align-items: flex-end;
  /* grid-template-columns: 22% 78%; */
}
.rightmain {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid #777777;
  width: 100%;
  height: 100%;
}
.rightmainbody {
  /* border: 1px solid #777777; */
  box-sizing: border-box;
  width: 50%;
  height: 25%;
  margin-left: 10%;
  margin-top: 3%;
}
.rightmaintext {
  display: flex;
  justify-content: flex-start;
  background: #ffffff;
  /* border: 1px solid #777777; */

  width: 100%;
  height: 31%;
}
.rightmaintextleft {
  background: #ffffff;
  font-size: 2.5vh;
  font-family: Microsoft YaHei, Microsoft YaHei-Normal;
  font-weight: Normal;
  text-align: left;
  color: #777777;
  /* border: 1px solid #a58f8f; */
  box-sizing: border-box;
  width: 20%;
  height: 100%;
}
.rightmaintextright {
  /* margin-top: 1%; */
  background: #ffffff;
  /* border: 1px solid #777777; */
  box-sizing: border-box;
  margin-left: 8%;
  width: 55%;
  height: 80%;
}
.rightmiddle {
  min-width: 700px;
  width: 85%;
  height: 45%;
  margin-left: 10%;
  background: #ffffff;
  /* border: 1px solid #777777; */
  box-sizing: border-box;
  font-size: 2.5vh;
  font-family: Microsoft YaHei, Microsoft YaHei-Normal;
  font-weight: Normal;
  text-align: left;
  color: #777777;
}

.rightmiddle /deep/ .w-e-text-container {
  height: 163px !important;
}
.rightfooter {
  display: flex;
  justify-content: center;
  width: 100%;
  height: 8%;
  background: #ffffff;
  /* border: 1px solid #777777; */
  margin-top: 5%;
  font-size: 2.5vh;
  font-family: Microsoft YaHei, Microsoft YaHei-Normal;
  font-weight: Normal;
  text-align: center;
  color: #777777;
  /* line-height: 35px; */
}
img {
  width: 100%;
  height: 100%;
}
</style>
<style>
* {
  margin: 0;
  padding: 0;
}
.el-input__inner {
  height: 30px;
  background: #ffffff;
  border: 1px solid #777777;
  box-sizing: border-box;
  border-radius: 0px;
}
</style>



